const logger = require('electron-log')

//判断系统类型
function getSystemType() {
    let os = require('os');
    let type = os.type();
    logger.info('os type: ' + type);
    if (type == 'Darwin') {
        return 'MacOS';
    } else if (type == 'Windows_NT') {
        return "Windows"
    } else if(type == 'Linux'){
        return "Linux"
    }
}

//判断系统版本
function getSystemVersion() {
    let os = require('os');
    let release = os.release();
    logger.info('os release: ' + release);
    if (release.startsWith('6.3')) {
        return 'Windows Server 2012 R2';
    } else if (release.startsWith('6.2')) {
        return 'Windows Server 2012';
    } else if (release.startsWith('6.1')) {
        return 'Windows Server 2008 R2';
    } else if (release.startsWith('6.0')) {
        return 'Windows Server 2008';
    } else if (release.startsWith('10.0.17763')) {
        return 'Windows Server 2019';
    } else {
        return release;
    }

}


exports.getSystemType = getSystemType;
exports.getSystemVersion = getSystemVersion;
